//---------------------------------------------------------------------------

#ifndef mainH
#define mainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
#include <Menus.hpp>
#include <Dialogs.hpp>

//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
typedef struct
{
    byte prescaler;
    byte tseg1;
    byte tseg2;
    byte sjw;
    double sp;
    Cardinal speed;
}TBittimingData;

class TMainForm : public TForm
{
__published:	// IDE-managed Components
        TStatusBar *StatusBar;
        TMainMenu *MainMenu1;
        TMenuItem *FileLoad1;
        TMenuItem *Operation1;
        TMenuItem *Help2;
        TMenuItem *About1;
        TTimer *BusStateTimer;
        TTimer *TimerRx;
        TPageControl *TxMessagePageControl;
        TTabSheet *TabSheet1;
        TPageControl *PageController;
        TTabSheet *TabPara;
        TLabel *Label6;
        TLabel *Label13;
        TGroupBox *GroupBox1;
        TLabel *Label1;
        TLabel *Label2;
        TLabel *Label3;
        TLabel *Label4;
        TLabel *Label5;
        TComboBox *ComboBox1;
        TEdit *SPTEdit;
        TEdit *SJWEdit;
        TComboBox *ComboBox3;
        TBitBtn *BitBtn1;
        TBitBtn *BitBtn2;
        TComboBox *ChannelCombo;
        TTabSheet *TabStatic;
        TGroupBox *GroupBox2;
        TLabel *Label7;
        TLabel *Label8;
        TLabel *Label9;
        TLabel *Label10;
        TLabel *Label11;
        TLabel *Label12;
        TLabel *RxTotalLabel;
        TLabel *RxPerLabel;
        TLabel *TxTotalLabel;
        TLabel *TxPerLabel;
        TLabel *Label17;
        TLabel *Label18;
        TBitBtn *BitBtn3;
        TBitBtn *BitBtn4;
        TBitBtn *BitBtn5;
        TRadioGroup *BusStRadioGroup;
        TTabSheet *TabFilter;
        TGroupBox *GroupBox3;
        TLabel *Label19;
        TLabel *Label20;
        TRadioButton *RadioButton4;
        TRadioButton *RadioButton5;
        TRadioButton *RadioButton6;
        TEdit *Edit2;
        TEdit *Edit3;
        TBitBtn *BitBtn6;
        TGroupBox *GroupBox4;
        TTabSheet *message;
        TMenuItem *Save1;
        TMenuItem *Exit1;
        TMenuItem *G1;
        TMenuItem *GoOffBus1;
        TGroupBox *GroupBox5;
        TLabel *Label22;
        TCheckBox *CheckBox_msg1;
        TLabel *Label14;
        TLabel *Label15;
        TLabel *Label16;
        TLabel *Label21;
        TLabel *Label23;
        TLabel *Label24;
        TLabel *Label25;
        TLabel *Label26;
        TLabel *Label27;
        TEdit *Edit_msg1_ID;
        TEdit *Edit_msg1_DLC;
        TEdit *Edit_msg1_data1;
        TEdit *Edit_msg1_data2;
        TEdit *Edit_msg1_data3;
        TEdit *Edit_msg1_data4;
        TEdit *Edit_msg1_data5;
        TEdit *Edit_msg1_data6;
        TEdit *Edit_msg1_data7;
        TEdit *Edit_msg1_data8;
        TCheckBox *CheckBox_msg2;
        TEdit *Edit_msg2_ID;
        TEdit *Edit_msg2_DLC;
        TEdit *Edit_msg2_data1;
        TEdit *Edit_msg2_data2;
        TEdit *Edit_msg2_data3;
        TEdit *Edit_msg2_data4;
        TEdit *Edit_msg2_data5;
        TEdit *Edit_msg2_data6;
        TEdit *Edit_msg2_data7;
        TEdit *Edit_msg2_data8;
        TBitBtn *BitBtn_msg1_Update;
        TEdit *Edit_msg3_data7;
        TEdit *Edit_msg4_data7;
        TEdit *Edit_msg3_data6;
        TEdit *Edit_msg4_data6;
        TEdit *Edit_msg3_data5;
        TEdit *Edit_msg4_data5;
        TEdit *Edit_msg3_data4;
        TEdit *Edit_msg4_data4;
        TEdit *Edit_msg3_data3;
        TEdit *Edit_msg4_data3;
        TEdit *Edit_msg3_data2;
        TEdit *Edit_msg4_data2;
        TEdit *Edit_msg3_data1;
        TEdit *Edit_msg4_data1;
        TEdit *Edit_msg3_DLC;
        TEdit *Edit_msg4_DLC;
        TEdit *Edit_msg3_ID;
        TEdit *Edit_msg4_ID;
        TCheckBox *CheckBox_msg4;
        TCheckBox *CheckBox_msg3;
        TEdit *Edit_msg3_data8;
        TEdit *Edit_msg4_data8;
        TEdit *Edit_Cycle1;
        TEdit *Edit_Cycle2;
        TEdit *Edit_Cycle3;
        TEdit *Edit_Cycle4;
        TLabel *Label28;
        TBitBtn *BitBtn_msg2_Update;
        TBitBtn *BitBtn_msg3_Update;
        TBitBtn *BitBtn_msg4_Update;
        TGroupBox *GroupBox6;
        TMemo *MemoText;
        TBitBtn *BitBtn7;
        void __fastcall FormCreate(TObject *Sender);
        void __fastcall ChannelComboChange(TObject *Sender);
        void __fastcall BitBtn4Click(TObject *Sender);
        void __fastcall BitBtn5Click(TObject *Sender);
        void __fastcall BusStateTimerTimer(TObject *Sender);
        void __fastcall About1Click(TObject *Sender);
        void __fastcall TimerRxTimer(TObject *Sender);
        void __fastcall BitBtn1Click(TObject *Sender);
        void __fastcall BitBtn7Click(TObject *Sender);
        void __fastcall Exit1Click(TObject *Sender);
        void __fastcall BitBtn_msg1_UpdateClick(TObject *Sender);
        void __fastcall BitBtn_msg2_UpdateClick(TObject *Sender);
        void __fastcall BitBtn_msg3_UpdateClick(TObject *Sender);
        void __fastcall BitBtn_msg4_UpdateClick(TObject *Sender);
        void __fastcall BitBtn3Click(TObject *Sender);
        void __fastcall ComboBox1Change(TObject *Sender);
private:	// User declarations
     HANDLE m_readhandle;
     TBittimingData SelectedBitTime;
     long FClockFreq ;
     //void ListAllBittimings(TListItems *s, long clock, long bitrate,double tolerance);
public:		// User declarations
        __fastcall TMainForm(TComponent* Owner);
        void Start_Timer(unsigned int ms_time_val);
        void End_timer(void);
        

};
//---------------------------------------------------------------------------
extern PACKAGE TMainForm *MainForm;
//---------------------------------------------------------------------------
#endif
